package com.fivestar.pmanager.core.base;

/**
 * ajax响应
 *
 */
public class AjaxRespBean
{
    public static final String SUCCESS = "0";
    public static final String FAIL = "1";
    private String status;
    private String msg;
    private Object data;

    public AjaxRespBean()
    {
        
    }
    
    /**
     * @param data
     */
    public AjaxRespBean(Object data)
    {
        super();
        this.data = data;
    }


    /**
     * @param status
     * @param data
     */
    public AjaxRespBean(String status, Object data)
    {
        super();
        this.status = status;
        this.data = data;
    }


    /**
     * @return Returns the status.
     */
    public String getStatus()
    {
        return status;
    }


    /**
     * @param status The status to set.
     */
    public AjaxRespBean setStatus(String status)
    {
        this.status = status;
        return this;
    }


    /**
     * @return Returns the msg.
     */
    public String getMsg()
    {
        return msg;
    }


    /**
     * @param msg The msg to set.
     */
    public AjaxRespBean setMsg(String msg)
    {
        this.msg = msg;
        return this;
    }


    /**
     * @return Returns the data.
     */
    public Object getData()
    {
        return data;
    }


    /**
     * @param data The data to set.
     * @return 
     */
    public AjaxRespBean setData(Object data)
    {
        this.data = data;
        return this;
    }
    
    public static AjaxRespBean failResp()
    {
        return new AjaxRespBean().setStatus(FAIL);
    }
    
    
    public static AjaxRespBean failResp(String msg)
    {
        return new AjaxRespBean().setStatus(FAIL).setMsg(msg);
    }
    
    
    public static AjaxRespBean failResp(Object data, String msg)
    {
        return new AjaxRespBean().setStatus(FAIL).setMsg(msg).setData(data);
    } 
    
    
    public static AjaxRespBean successResp()
    {
        return new AjaxRespBean().setStatus(SUCCESS);
    }
    
    public static AjaxRespBean successResp(Object data)
    {
        return new AjaxRespBean().setStatus(SUCCESS).setData(data);
    }

    public static AjaxRespBean successResp(Object data,String msg)
    {
        return new AjaxRespBean().setStatus(SUCCESS).setData(data).setMsg(msg);
    }

}
